<!DOCTYPE html>
<html>
<head>
    <title>搜索内容</title>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/js/bootstrap-4.1.1-dist/css/bootstrap.min.css">
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/bootstrap-4.1.1-dist/js/bootstrap.min.js"></script>
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/css/reset.css"/>
    <link rel="stylesheet" href="/css/userTravels.css"/>
    <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css"/>
    <script src="/js/plugins/dialog2/dialog.min.js"></script>
    <script src="/js/common.js"></script>
    <script>
        $(function () {
            var user = JSON.parse(sessionStorage.getItem("user"));//得到的是登录的用户的信息
            console.log(user);
            console.log(user.id);

            //当前页
            var currentPage = 1;
            //总页数
            var pages;
            //存储游记的数组
            var travelArr = [];

            function query() {
                //获取我的
                $.get(baseUrl + '/users/strategy/CheckGood?userId=' + user.id ,{currentPage:currentPage}, function (data) {

                    //把第二个数组合并第一个数组中
                    console.log(data);
                    $.merge(travelArr, data.list);
                    var json = {
                        list: travelArr
                    };
                    //渲染数据
                    $(".strategy").renderValues(json, {
                        getHref: getHref
                    });
                    console.log(json);
                    //获取总页数
                    pages = data.pages;
                })
                currentPage = currentPage + 1;
            }

            //默认查询第一页
            query();
            //给window绑定滚动事件
            $(window).scroll(function () {
                if ($(window).height() + $(document).scrollTop() + 50 >= $(document).height()) {
                    //如果是小于总页数就发送请求
                    if (currentPage <= pages) {
                        query();
                    } else {
                        $(document).dialog({
                            type: 'notice',
                            content: '<span class="info-text">亲,已经到底了!</span>',
                            autoClose: 2500
                        });
                    }
                }
            });
        });
    </script>
</head>


<body>
<div class="search-head">
    <div class="row nav-search">
        <div class="col-2">
            <a href="javascript:history.go(-1);">
                <span><i class="fa fa-chevron-left fa-2x"></i></span>
            </a>
        </div>
        <div class="col-8">
            <div class="input-group-sm search">
                <p style="color: white; font-size: 20px">点赞人</p>
            </div>
        </div>
    </div>
</div>

<div class="tab-content travels" id="pills-tabContent">
    <div class="tab-pane fade active show">

        <div class="container strategy">
            <div render-loop="list">
                <a data-url="strategyDetails.html?id=" render-fun="getHref" render-key="list.strategyDetail.id">
                    <p render-html="list.user.nickName"></p>
                    <img render-src="list.user.headImgUrl" width="50px">
                </a>
            </div>
        </div>
        <hr>


    </div>


    <div class="tab-content travels" id="Content">
        <div class="tab-pane fade" id="pills-travel">

            <div class="container travel">
                <div render-loop="list">
                    <a data-url="travelContent.html?id=" render-fun="getHref" render-key="list.travel.id">
                        <p render-html="list.travel.title">标题:</p>
                        <img render-src="list.travel.coverUrl" width="100%">
                    </a>
                </div>
            </div>
            <hr>
        </div>
        <!--<div render-loop="list">
            <div class="container commend">
                <a data-href="travelContent.html?id=" render-fun="getHref" render-key="list.id">
                    <p render-html="list.title"></p>
                    <img render-src="list.coverUrl">
                </a>
            </div>
            <hr>
        </div>-->
    </div>
    <div class="tab-pane fade" id="pills-newsPage">
        <!--<div render-loop="list">
            <div class="container commend">
                <a data-href="newsContent.html?id=" render-fun="getHref" render-key="list.id">
                    <p render-html="list.title"></p>
                    <img render-src="list.coverUrl">
                </a>
            </div>
            <hr>
        </div>-->
    </div>
</div>
</body>

</html>
